package com.l.web.master.login;

import com.l.web.master.system.user.User;
import com.l.web.master.system.user.UserDAO;
import org.apache.log4j.Logger;
import org.l.qiao.search.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {

    private static final Logger LOGGER = Logger.getLogger(LoginService.class);

    @Autowired
    private UserDAO userDAO;

    public User getUser(Login login) {
        Query query = new Query();
        query.eq(User.USER_NAME, login.get(Login.USER_NAME));
        query.eq(User.PASSWORD, login.get(Login.PASSWORD));
        User user = new User(userDAO.findOne(query));
        return user;
    }
}
